<?php
/**
 * The Template for displaying all single posts.
 *
 */

get_header(); 


?>
<div class="content" role="main">

        <?php if (have_posts()) : ?>
            <?php while (have_posts()) : the_post(); ?>
                <?php $projetStatus = get_post_status( get_the_id() ); // Récupère le status du post ?>
                <article <?php if( !empty( $rv['review'] ) ) echo $rv['review']; post_class('post-listing'); ?>>
                    <div class="post-inner">
                        
                        <header class="entry-header">
                            <h1 class="name post-title entry-title entry-title"><?php the_title(); ?></h1>
                        </header>
                        
                        <div class="entry-content">
                            <?php
                                if ( has_post_thumbnail() ) {
                                    echo the_post_thumbnail('thumbnail', array('class' => 'alignleft'));
                                }
                            ?>
                            <?php the_content(); ?>
                        </div>

                        <?php
                            //$test = get_post_meta(get_the_ID(), 'wpspo_boxclose', true); // TODO : Si le projet est clos

                            if(wpspo_compare_date(get_post_meta(get_the_ID(), 'wpspo_boxdateend', true))==true or get_post_meta(get_the_ID(), 'wpspo_boxnodate', true) == 1) {
                        ?>
                            <br /><br /><div style="text-align:center;"><?php echo do_shortcode("[wpspobutton taille='large' content='".__('Organize a challenge', 'sponsorpress')."' link='".get_permalink(WPSPO_ID_ORGANISER).WPSPO_LINK_PROJECT.sanitize_title(get_the_title())."'][/wpspobutton]"); ?>
                   </div><br /><br />
                        <?php
                                echo wpspo_listing_defis(get_the_ID());


                            }
                        ?>

                    </div>
                </article>

            <?php endwhile; ?>
           
           <?php comments_template( '', true ); ?>
           
        <?php endif; ?>
    
</div><!-- #content -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>